<?php
// +----------------------------------------------------------------------
// | ZanPianCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.zanpian.com All rights reserved.
// +----------------------------------------------------------------------
// | BBS:  <http://www.feifeicms.cc>
// +----------------------------------------------------------------------
namespace app\common\validate;
class Role extends Base{
 protected $rule = [
        ['role_vid', 'require|number', '视频ID不能为空|视频ID必须为数字'],
		['role_name', 'require|unique:role,role_vid^role_name', '角色名称不能为空|角色名已存在'],
		['role_star', 'unique:role,role_vid^role_star', '演员已存在'],
		['role_cid', 'require|number|checkCid', '角色分类不能为空|角色分类必须为数字|请选择当前角色分类下面的子栏目'],
    ];
      protected function checkCid($value){
          	$tree= list_search(F('_data/listtree'),'list_id='.$value);
	        if(!empty($tree[0]['son'])){
		       return false;
	        }else{
	           return true;
	        }
    }
}